#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example

use chrono::Local;
use work_list::myapp::MyApp;

fn main() -> eframe::Result {
    let options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default().with_inner_size([900.0, 600.0]),
        ..Default::default()
    };
    //文件名称  yy-MM-dd
    let mut today_work_file_name = Local::now().format("%y-%m-%d").to_string();
    today_work_file_name.push_str(".json");
    println!("curent time: {}", &today_work_file_name);
    eframe::run_native(
        "Works Todo",
        options,
        Box::new(|cc| {
            let mut my_app = MyApp::new(cc);
            my_app.read_today_works(today_work_file_name);
            //my_app.add_current_works();
            Ok(Box::<MyApp>::new(my_app))
        }),
    )
}
